let nums = [2,7,9,3,1]
let len = nums.length
if(len == 1){
    return nums[0]
}else if(len == 2){
    return Math.max(nums[0], nums[1])
}
let dp = new Array(len).fill(0)
dp[0] = nums[0]
dp[1] = Math.max(nums[0], nums[1])

for(i = 2; i < nums.length; i++){
    dp[i] = Math.max(dp[i-1], nums[i] + dp[i-2])
}
console.log(dp[i - 1])
